package org.fixies.testcase;

import org.hamcrest.Matcher;
import org.junit.Rule;
import org.junit.rules.ExpectedException;
import org.junit.rules.TestName;
import org.junit.runners.model.FrameworkMethod;
import org.junit.runners.model.Statement;

/**
 * // TODO change this
 * User: Tsuyoshi
 * Date: 10/12/12
 * Time: 20:54
 */
public abstract class TestBase {

    @Rule
    public TestName testName = new TestName();

    @Rule
    public ExpectedException expectedException = ExpectedException.none();

    public TestBase() {
    }

    protected final void expect(Matcher<?> matcher) {
        expectedException.expect(matcher);
    }

    protected final void expect(Class<? extends Throwable> type) {
        expectedException.expect(type);
    }

    protected final void expectMessage(String substring) {
        expectedException.expectMessage(substring);
    }

    protected final void expectMessage(Matcher<String> matcher) {
        expectedException.expectMessage(matcher);
    }

    protected final String getName() {
        return testName.getMethodName();
    }

}
